<template>
  <div class="scj">
   <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
     <van-list
     
       :finished="finished"
       finished-text="没有更多了"
   	
   	
    
   	    :offset="400"
     >
   	   <!-- <router-link :to="`/detail/${item._id}?collectionName=home`"> -->
       <van-cell v-for="(item,index) of home" :key="item._id">
   		    <router-link :to="`/detail/${item._id}?collectionName=home`">
   		   <div id="">
   		   	 <h2>{{index + 1}}.{{item.title}}</h2>
   		   <p>{{item.des}}</p>
   		   
   		   </div>
   		   </router-link>
   		  
   		    </van-cell> 
   			 
   			<!-- <button class="an" type="button" @click="onLoad" >{{anniu}}</button> -->
     </van-list>
   </van-pull-refresh>
   </div>
</template>

<script>
 // import axios from "../plugins/axios.js"
 export default {
   name:'scj',
   props:{},
   data(){
     return {
 		 b:"",
 		 anniu:"加载更多",
 		 page:1,
 		  home:"",
       banner:[],
 	    list: [],
 	         loading: false,
 	         finished: false,
 	         refreshing: false,
     }
   },
   components:{},
   mounted(){
	   let a = window.localStorage.getItem('user');
	   
	   	let b = JSON.parse(a).username
		console.log(b)
    this.$axios({
    	   // url:`/api/news/home/5e8a0a406a1fc35a2d71f01b/1768`,
         url:`/api/news/home`,
    	 // url:`/api/news/home/5e8a0a406a1fc35a2d71f01b`
    	 // method:'get',
         params:{_limit:10,q:b},
    	 
    	 // tip:"热点"
       }).then(
         res=>{
          // console.log($baseUrl);
        			this.home=res.data.data
    				console.log(res)
    				}
       )
   },
   updated(){
   },
   methods:{
 	 //   nnn(a){
 		// this.loading=false
 		// this.finished=false
 		// this.page = 1
 		
 		//    // this.loading = true;
 		//    if(a==1)this.b="热点";
 		//    if(a==2)this.b="娱乐";
 		//    if(a==3)this.b="政治";
 		//    if(a==4)this.b="本地";
 		   
 		//    if(a==5)this.b="国际";
 		//    if(a==6)this.b="游戏";
 		  
 		  
 		//    // console.log(`/api/news/home/${b}`)
 		//    this.$axios({
 		// 	   // url:`/api/news/home/5e8a0a406a1fc35a2d71f01b/1768`,
 		//      url:`/api/news/home`,
 		// 	 // url:`/api/news/home/5e8a0a406a1fc35a2d71f01b`
 		// 	 // method:'get',
 		//      params:{_limit:10,q:this.b},
 			 
 		// 	 // tip:"热点"
 		//    }).then(
 		//      res=>{
 		//       // console.log($baseUrl);
 		//     			this.home=res.data.data
 		// 				console.log(res)
 		// 				}
 		//    )
 	 //   },
 	    
 	      
 },
 }
</script>

<style>
  .app{}
</style>
